package com.atcc.demo.domain;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

public class TestFilter implements Filter{
	
	@Override
	public void init(javax.servlet.FilterConfig filterConfig) throws ServletException {
		System.out.println("随便初始化一下");
	}
	
    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
    		throws IOException, ServletException {
    	System.out.println("每一个请求打印一个时间测试");
    	long start = System.currentTimeMillis();
    	chain.doFilter(request, response);
    	long end = System.currentTimeMillis()-start;
    	System.out.println("当前请求所花费的时间：" + end);
    }

    @Override
    public void destroy() {
    	System.out.println("顺便销毁一下");
    }
}
